// System Unit
// Unicode String Support

(*************)
(* Interface *)
(*************)
{$IFDEF Include_Modules_Header}

 Type
  PString = PUnicodeString;

 Procedure _LStrFromPWCharLen(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);
 Type RTLProc_LStrFromPWCharLen = Procedure(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);

 Procedure _LStrFromWChar(Var Dest: ANSIString; Source: WideChar; CodePage: Word);
 Type RTLProc_LStrFromWChar = Procedure(Var Dest: ANSIString; Source: WideChar; CodePage: Word);

 Procedure _LStrFromPWChar(Var Dest: ANSIString; Source: PWideChar; CodePage: Word);
 Type RTLProc_LStrFromPWChar = Procedure(Var Dest: ANSIString; Source: PWideChar; CodePage: Word);

 Procedure _LStrFromString(Var Dest: ANSIString; Const Source: ShortString; CodePage: Word);
 Type RTLProc_LStrFromString = Procedure(Var Dest: ANSIString; Const Source: ShortString; CodePage: Word);

 Procedure _LStrFromWArray(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);
 Type RTLProc_LStrFromWArray = Procedure(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);

 Procedure _LStrFromWStr(Var Dest: ANSIString; Const Source: WideString; CodePage: Word);
 Type RTLProc_LStrFromWStr = Procedure(Var Dest: ANSIString; Const Source: WideString; CodePage: Word);

 Procedure _LStrFromUStr(Var Dest: ANSIString; Const Source: UnicodeString; CodePage: Word);
 Type RTLProc_LStrFromUStr = Procedure(Var Dest: ANSIString; Const Source: UnicodeString; CodePage: Word);

 Procedure _LStrToString(Dest: PShortString; Const Source: ANSIString; MaxLen: Integer);
 Type RTLProc_LStrToString = Procedure(Dest: PShortString; Const Source: ANSIString; MaxLen: Integer);

 Procedure _WCharToString(Dest: PShortString; Const Source: WideChar; MaxLen: Integer);
 Type RTLProc_WCharToString = Procedure(Dest: PShortString; Const Source: WideChar; MaxLen: Integer);

 Procedure _WStrFromPCharLen(Var Dest: WideString; Source: PANSIChar; Length: Integer);
 Type RTLProc_WStrFromPCharLen = Procedure(Var Dest: WideString; Source: PANSIChar; Length: Integer);

 Procedure _WStrFromChar(Var Dest: WideString; Source: ANSIChar);
 Type RTLProc_WStrFromChar = Procedure(Var Dest: WideString; Source: ANSIChar);

 Procedure _WStrFromPChar(Var Dest: WideString; Source: PANSIChar);
 Type RTLProc_WStrFromPChar = Procedure(Var Dest: WideString; Source: PANSIChar);

 Procedure _WStrFromString(Var Dest: WideString; Const Source: ShortString);
 Type RTLProc_WStrFromString = Procedure(Var Dest: WideString; Const Source: ShortString);

 Procedure _WStrFromArray(Var Dest: WideString; Source: PANSIChar; Length: Integer);
 Type RTLProc_WStrFromArray = Procedure(Var Dest: WideString; Source: PANSIChar; Length: Integer);

 Procedure _WStrFromLStr(Var Dest: WideString; Const Source: ANSIString);
 Type RTLProc_WStrFromLStr = Procedure(Var Dest: WideString; Const Source: ANSIString);

 Procedure _WStrFromUStr(Var Dest: WideString; Const Source: UnicodeString);
 Type RTLProc_WStrFromUStr = Procedure(Var Dest: WideString; Const Source: UnicodeString);

 Procedure _WStrToString(Dest: PShortString; Const Source: WideString; MaxLen: Integer);
 Type RTLProc_WStrToString = Procedure(Dest: PShortString; Const Source: WideString; MaxLen: Integer);

 Procedure _UStrFromPCharLen(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);
 Type RTLProc_UStrFromPCharLen = Procedure(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);

 Procedure _UStrFromChar(Var Dest: UnicodeString; Source: ANSIChar);
 Type RTLProc_UStrFromChar = Procedure(Var Dest: UnicodeString; Source: ANSIChar);

 Procedure _UStrFromPChar(Var Dest: UnicodeString; Source: PANSIChar);
 Type RTLProc_UStrFromPChar = Procedure(Var Dest: UnicodeString; Source: PANSIChar);

 Procedure _UStrFromString(Var Dest: UnicodeString; Const Source: ShortString);
 Type RTLProc_UStrFromString = Procedure(Var Dest: UnicodeString; Const Source: ShortString);

 Procedure _UStrFromArray(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);
 Type RTLProc_UStrFromArray = Procedure(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);

 Procedure _UStrFromLStr(Var Dest: UnicodeString; Const Source: ANSIString);
 Type RTLProc_UStrFromLStr = Procedure(Var Dest: UnicodeString; Const Source: ANSIString);

 Procedure _UStrFromWStr(Var Dest: UnicodeString; Const Source: WideString);
 Type RTLProc_UStrFromWStr = Procedure(Var Dest: UnicodeString; Const Source: WideString);

 Procedure _UStrToString(Dest: PShortString; Const Source: UnicodeString; MaxLen: Integer);
 Type RTLProc_UStrToString = Procedure(Dest: PShortString; Const Source: UnicodeString; MaxLen: Integer);

 { PANSIChar/PWideChar Unicode <-> UTF8 conversion }

 Type RTLProc_UnicodeToUTF8 = Function(Dest: PANSIChar; MaxDestBytes: Cardinal; Source: PWideChar; SourceChars: Cardinal): Cardinal;
 Var UnicodeToUTF8: RTLProc_UnicodeToUTF8 = NIL;

 Type RTLProc_UTF8ToUnicode = Function(Dest: PWideChar; MaxDestChars: Cardinal; Source: PANSIChar; SourceBytes: Cardinal): Cardinal;
 Var UTF8ToUnicode: RTLProc_UTF8ToUnicode = NIL;

 { WideString <-> UTF8 conversion }

 Function UTF8Encode(Const WS: WideString): RawByteString; Overload;
 Function UTF8Encode(Const US: UnicodeString): RawByteString; Overload;
 Function UTF8Encode(Const A: RawByteString): RawByteString; Overload;

 Type RTLProc_UTF8EncodeW = Function(Const WS: WideString): RawByteString;
 Var _UTF8EncodeW: RTLProc_UTF8EncodeW = NIL;

 Type RTLProc_UTF8EncodeU = Function(Const US: UnicodeString): RawByteString;
 Var _UTF8EncodeU: RTLProc_UTF8EncodeU = NIL;

 Type RTLProc_UTF8EncodeL = Function(Const A: RawByteString): RawByteString;
 Var _UTF8EncodeL: RTLProc_UTF8EncodeL = NIL;

 Function UTF8EncodeToShortString(Const WS: WideString): ShortString; Overload;
 Function UTF8EncodeToShortString(Const US: UnicodeString): ShortString; Overload;
 Function UTF8EncodeToShortString(Const A: RawByteString): ShortString; Overload;

 Type RTLProc_UTF8EncodeWToShortString = Function(Const WS: WideString): ShortString;
 Var _UTF8EncodeWToShortString: RTLProc_UTF8EncodeWToShortString = NIL;

 Type RTLProc_UTF8EncodeUToShortString = Function(Const US: UnicodeString): ShortString;
 Var _UTF8EncodeUToShortString: RTLProc_UTF8EncodeUToShortString = NIL;

 Type RTLProc_UTF8EncodeLToShortString = Function(Const A: RawByteString): ShortString;
 Var _UTF8EncodeLToShortString: RTLProc_UTF8EncodeLToShortString = NIL;

 Type RTLProc_UTF8ToWideString = Function(Const S: RawByteString): WideString;
 Var UTF8ToWideString: RTLProc_UTF8ToWideString = NIL;

 Function UTF8ToUnicodeString(Const S: RawByteString): UnicodeString; Overload;
 Function UTF8ToUnicodeString(Const S: ShortString): UnicodeString; Overload;
 Function UTF8ToUnicodeString(Const S: PANSIChar): UnicodeString; Overload;

 Type RTLProc_UTF8LStrToUnicodeString = Function(Const S: RawByteString): UnicodeString;
 Var _UTF8LStrToUnicodeString: RTLProc_UTF8LStrToUnicodeString = NIL;

 Type RTLProc_UTF8PStrToUnicodeString = Function(Const S: ShortString): UnicodeString;
 Var _UTF8PStrToUnicodeString: RTLProc_UTF8PStrToUnicodeString = NIL;

 Type RTLProc_UTF8PCharToUnicodeString = Function(Const S: PANSIChar): UnicodeString;
 Var _UTF8PCharToUnicodeString: RTLProc_UTF8PCharToUnicodeString = NIL;

 Function UTF8ToString(Const S: RawByteString): String; Overload;
 Function UTF8ToString(Const S: ShortString): String; Overload;
 Function UTF8ToString(Const S: PANSIChar): String; Overload;
 Function UTF8ToString(Const S: Array of ANSIChar): String; Overload;

 Type RTLProc_UTF8LStrToString = Function(Const S: RawByteString): String;
 Var _UTF8LStrToString: RTLProc_UTF8LStrToString = NIL;

 Type RTLProc_UTF8PStrToString = Function(Const S: ShortString): String;
 Var _UTF8PStrToString: RTLProc_UTF8PStrToString = NIL;

 Type RTLProc_UTF8PCharToString = Function(Const S: PANSIChar): String;
 Var _UTF8PCharToString: RTLProc_UTF8PCharToString = NIL;

 Type RTLProc_UTF8ArrayToString = Function(Const S: Array of ANSIChar): String;
 Var _UTF8ArrayToString: RTLProc_UTF8ArrayToString = NIL;

 //==================
 // RTL Extensions
 //==================
 Type
  TRTLEx_StringConv = Record
   _LStrFromPWCharLen: RTLProc_LStrFromPWCharLen;
   _LStrFromWChar: RTLProc_LStrFromWChar;
   _LStrFromPWChar: RTLProc_LStrFromPWChar;
   _LStrFromString: RTLProc_LStrFromString;
   _LStrFromWArray: RTLProc_LStrFromWArray;
   _LStrFromWStr: RTLProc_LStrFromWStr;
   _LStrFromUStr: RTLProc_LStrFromUStr;
   _LStrToString: RTLProc_LStrToString;
   _WCharToString: RTLProc_WCharToString;
   _WStrFromPCharLen: RTLProc_WStrFromPCharLen;
   _WStrFromChar: RTLProc_WStrFromChar;
   _WStrFromPChar: RTLProc_WStrFromPChar;
   _WStrFromString: RTLProc_WStrFromString;
   _WStrFromArray: RTLProc_WStrFromArray;
   _WStrFromLStr: RTLProc_WStrFromLStr;
   _WStrFromUStr: RTLProc_WStrFromUStr;
   _WStrToString: RTLProc_WStrToString;
   _UStrFromPCharLen: RTLProc_UStrFromPCharLen;
   _UStrFromChar: RTLProc_UStrFromChar;
   _UStrFromPChar: RTLProc_UStrFromPChar;
   _UStrFromString: RTLProc_UStrFromString;
   _UStrFromArray: RTLProc_UStrFromArray;
   _UStrFromLStr: RTLProc_UStrFromLStr;
   _UStrFromWStr: RTLProc_UStrFromWStr;
   _UStrToString: RTLProc_UStrToString;
   UnicodeToUTF8: RTLProc_UnicodeToUTF8;
   UTF8ToUnicode: RTLProc_UTF8ToUnicode;
   _UTF8EncodeW: RTLProc_UTF8EncodeW;
   _UTF8EncodeU: RTLProc_UTF8EncodeU;
   _UTF8EncodeL: RTLProc_UTF8EncodeL;
   _UTF8EncodeWToShortString: RTLProc_UTF8EncodeWToShortString;
   _UTF8EncodeUToShortString: RTLProc_UTF8EncodeUToShortString;
   _UTF8EncodeLToShortString: RTLProc_UTF8EncodeLToShortString;
   UTF8ToWideString: RTLProc_UTF8ToWideString;
   _UTF8LStrToUnicodeString: RTLProc_UTF8LStrToUnicodeString;
   _UTF8PStrToUnicodeString: RTLProc_UTF8PStrToUnicodeString;
   _UTF8PCharToUnicodeString: RTLProc_UTF8PCharToUnicodeString;
   _UTF8LStrToString: RTLProc_UTF8LStrToString;
   _UTF8PStrToString: RTLProc_UTF8PStrToString;
   _UTF8PCharToString: RTLProc_UTF8PCharToString;
   _UTF8ArrayToString: RTLProc_UTF8ArrayToString;
  END;

 Procedure RTLExtend_StringConv(Var Ex: TRTLEx_StringConv);

{$ENDIF Include_Modules_Header}
(******************)
(* Implementation *)
(******************)
{$IFDEF Include_Modules_Implement}

 Procedure _RTL_LStrFromPWCharLen(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrFromWChar(Var Dest: ANSIString; Source: WideChar; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrFromPWChar(Var Dest: ANSIString; Source: PWideChar; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrFromString(Var Dest: ANSIString; Const Source: ShortString; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrFromWArray(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrFromWStr(Var Dest: ANSIString; Const Source: WideString; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrFromUStr(Var Dest: ANSIString; Const Source: UnicodeString; CodePage: Word);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_LStrToString(Dest: PShortString; Const Source: ANSIString; MaxLen: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WCharToString(Dest: PShortString; Const Source: WideChar; MaxLen: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromPCharLen(Var Dest: WideString; Source: PANSIChar; Length: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromChar(Var Dest: WideString; Source: ANSIChar);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromPChar(Var Dest: WideString; Source: PANSIChar);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromString(Var Dest: WideString; Const Source: ShortString);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromArray(Var Dest: WideString; Source: PANSIChar; Length: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromLStr(Var Dest: WideString; Const Source: ANSIString);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrFromUStr(Var Dest: WideString; Const Source: UnicodeString);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_WStrToString(Dest: PShortString; Const Source: WideString; MaxLen: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromPCharLen(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromChar(Var Dest: UnicodeString; Source: ANSIChar);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromPChar(Var Dest: UnicodeString; Source: PANSIChar);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromString(Var Dest: UnicodeString; Const Source: ShortString);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromArray(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromLStr(Var Dest: UnicodeString; Const Source: ANSIString);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrFromWStr(Var Dest: UnicodeString; Const Source: WideString);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_UStrToString(Dest: PShortString; Const Source: UnicodeString; MaxLen: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UnicodeToUTF8(Dest: PANSIChar; MaxDestBytes: Cardinal; Source: PWideChar; SourceChars: Cardinal): Cardinal;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; Source: PANSIChar; SourceBytes: Cardinal): Cardinal;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8EncodeW(Const WS: WideString): RawByteString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8EncodeU(Const US: UnicodeString): RawByteString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8EncodeL(Const A: RawByteString): RawByteString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function UTF8Encode(Const WS: WideString): RawByteString;
  ASM
   JMP _UTF8EncodeW
  END;

 Function UTF8Encode(Const US: UnicodeString): RawByteString;
  ASM
   JMP _UTF8EncodeU
  END;

 Function UTF8Encode(Const A: RawByteString): RawByteString;
  ASM
   JMP _UTF8EncodeL
  END;

 Function _RTL_UTF8EncodeWToShortString(Const WS: WideString): ShortString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8EncodeUToShortString(Const US: UnicodeString): ShortString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8EncodeLToShortString(Const A: RawByteString): ShortString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function UTF8EncodeToShortString(Const WS: WideString): ShortString;
  ASM
   JMP _UTF8EncodeWToShortString
  END;

 Function UTF8EncodeToShortString(Const US: UnicodeString): ShortString;
  ASM
   JMP _UTF8EncodeUToShortString
  END;

 Function UTF8EncodeToShortString(Const A: RawByteString): ShortString;
  ASM
   JMP _UTF8EncodeLToShortString
  END;

 Function _RTL_UTF8ToWideString(Const S: RawByteString): WideString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8LStrToUnicodeString(Const S: RawByteString): UnicodeString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8PStrToUnicodeString(Const S: ShortString): UnicodeString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8PCharToUnicodeString(Const S: PANSIChar): UnicodeString;
  ASM
   JMP _INT_NotImplemented
  END;

 Function UTF8ToUnicodeString(Const S: RawByteString): UnicodeString;
  ASM
   JMP _RTL_UTF8LStrToUnicodeString
  END;

 Function UTF8ToUnicodeString(Const S: ShortString): UnicodeString;
  ASM
   JMP _RTL_UTF8PStrToUnicodeString
  END;

 Function UTF8ToUnicodeString(Const S: PANSIChar): UnicodeString;
  ASM
   JMP _RTL_UTF8PCharToUnicodeString
  END;

 Function _RTL_UTF8LStrToString(Const S: RawByteString): String;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8PStrToString(Const S: ShortString): String;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8PCharToString(Const S: PANSIChar): String;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_UTF8ArrayToString(Const S: Array of ANSIChar): String;
  ASM
   JMP _INT_NotImplemented
  END;

 Function UTF8ToString(Const S: RawByteString): String;
  ASM
   JMP _UTF8LStrToString
  END;

 Function UTF8ToString(Const S: ShortString): String;
  ASM
   JMP _UTF8PStrToString
  END;

 Function UTF8ToString(Const S: PANSIChar): String;
  ASM
   JMP _UTF8PCharToString
  END;

 Function UTF8ToString(Const S: Array of ANSIChar): String;
  ASM
   JMP _UTF8ArrayToString
  END;

 Var
  RTL_LStrFromPWCharLen: RTLProc_LStrFromPWCharLen = _RTL_LStrFromPWCharLen;
  RTL_LStrFromWChar: RTLProc_LStrFromWChar = _RTL_LStrFromWChar;
  RTL_LStrFromPWChar: RTLProc_LStrFromPWChar = _RTL_LStrFromPWChar;
  RTL_LStrFromString: RTLProc_LStrFromString = _RTL_LStrFromString;
  RTL_LStrFromWArray: RTLProc_LStrFromWArray = _RTL_LStrFromWArray;
  RTL_LStrFromWStr: RTLProc_LStrFromWStr = _RTL_LStrFromWStr;
  RTL_LStrFromUStr: RTLProc_LStrFromUStr = _RTL_LStrFromUStr;
  RTL_LStrToString: RTLProc_LStrToString = _RTL_LStrToString;
  RTL_WCharToString: RTLProc_WCharToString = _RTL_WCharToString;
  RTL_WStrFromPCharLen: RTLProc_WStrFromPCharLen = _RTL_WStrFromPCharLen;
  RTL_WStrFromChar: RTLProc_WStrFromChar = _RTL_WStrFromChar;
  RTL_WStrFromPChar: RTLProc_WStrFromPChar = _RTL_WStrFromPChar;
  RTL_WStrFromString: RTLProc_WStrFromString = _RTL_WStrFromString;
  RTL_WStrFromArray: RTLProc_WStrFromArray = _RTL_WStrFromArray;
  RTL_WStrFromLStr: RTLProc_WStrFromLStr = _RTL_WStrFromLStr;
  RTL_WStrFromUStr: RTLProc_WStrFromUStr = _RTL_WStrFromUStr;
  RTL_WStrToString: RTLProc_WStrToString = _RTL_WStrToString;
  RTL_UStrFromPCharLen: RTLProc_UStrFromPCharLen = _RTL_UStrFromPCharLen;
  RTL_UStrFromChar: RTLProc_UStrFromChar = _RTL_UStrFromChar;
  RTL_UStrFromPChar: RTLProc_UStrFromPChar = _RTL_UStrFromPChar;
  RTL_UStrFromString: RTLProc_UStrFromString = _RTL_UStrFromString;
  RTL_UStrFromArray: RTLProc_UStrFromArray = _RTL_UStrFromArray;
  RTL_UStrFromLStr: RTLProc_UStrFromLStr = _RTL_UStrFromLStr;
  RTL_UStrFromWStr: RTLProc_UStrFromWStr = _RTL_UStrFromWStr;
  RTL_UStrToString: RTLProc_UStrToString = _RTL_UStrToString;

 Procedure _LStrFromPWCharLen(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);
  ASM
   JMP RTL_LStrFromPWCharLen
  END;

 Procedure _LStrFromWChar(Var Dest: ANSIString; Source: WideChar; CodePage: Word);
  ASM
   JMP RTL_LStrFromWChar
  END;

 Procedure _LStrFromPWChar(Var Dest: ANSIString; Source: PWideChar; CodePage: Word);
  ASM
   JMP RTL_LStrFromPWChar
  END;

 Procedure _LStrFromString(Var Dest: ANSIString; Const Source: ShortString; CodePage: Word);
  ASM
   JMP RTL_LStrFromString
  END;

 Procedure _LStrFromWArray(Var Dest: ANSIString; Source: PWideChar; Length: Integer; CodePage: Word);
  ASM
   JMP RTL_LStrFromWArray
  END;

 Procedure _LStrFromWStr(Var Dest: ANSIString; Const Source: WideString; CodePage: Word);
  ASM
   JMP RTL_LStrFromWStr
  END;

 Procedure _LStrFromUStr(Var Dest: ANSIString; Const Source: UnicodeString; CodePage: Word);
  ASM
   JMP RTL_LStrFromUStr
  END;

 Procedure _LStrToString(Dest: PShortString; Const Source: ANSIString; MaxLen: Integer);
  ASM
   JMP RTL_LStrToString
  END;

 Procedure _WCharToString(Dest: PShortString; Const Source: WideChar; MaxLen: Integer);
  ASM
   JMP RTL_WCharToString
  END;

 Procedure _WStrFromPCharLen(Var Dest: WideString; Source: PANSIChar; Length: Integer);
  ASM
   JMP RTL_WStrFromPCharLen
  END;

 Procedure _WStrFromChar(Var Dest: WideString; Source: ANSIChar);
  ASM
   JMP RTL_WStrFromChar
  END;

 Procedure _WStrFromPChar(Var Dest: WideString; Source: PANSIChar);
  ASM
   JMP RTL_WStrFromPChar
  END;

 Procedure _WStrFromString(Var Dest: WideString; Const Source: ShortString);
  ASM
   JMP RTL_WStrFromString
  END;

 Procedure _WStrFromArray(Var Dest: WideString; Source: PANSIChar; Length: Integer);
  ASM
   JMP RTL_WStrFromArray
  END;

 Procedure _WStrFromLStr(Var Dest: WideString; Const Source: ANSIString);
  ASM
   JMP RTL_WStrFromLStr
  END;

 Procedure _WStrFromUStr(Var Dest: WideString; Const Source: UnicodeString);
  ASM
   JMP RTL_WStrFromUStr
  END;

 Procedure _WStrToString(Dest: PShortString; Const Source: WideString; MaxLen: Integer);
  ASM
   JMP RTL_WStrToString
  END;

 Procedure _UStrFromPCharLen(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);
  ASM
   JMP RTL_UStrFromPCharLen
  END;

 Procedure _UStrFromChar(Var Dest: UnicodeString; Source: ANSIChar);
  ASM
   JMP RTL_UStrFromChar
  END;

 Procedure _UStrFromPChar(Var Dest: UnicodeString; Source: PANSIChar);
  ASM
   JMP RTL_UStrFromPChar
  END;

 Procedure _UStrFromString(Var Dest: UnicodeString; Const Source: ShortString);
  ASM
   JMP RTL_UStrFromString
  END;

 Procedure _UStrFromArray(Var Dest: UnicodeString; Source: PANSIChar; Length: Integer);
  ASM
   JMP RTL_UStrFromArray
  END;

 Procedure _UStrFromLStr(Var Dest: UnicodeString; Const Source: ANSIString);
  ASM
   JMP RTL_UStrFromLStr
  END;

 Procedure _UStrFromWStr(Var Dest: UnicodeString; Const Source: WideString);
  ASM
   JMP RTL_UStrFromWStr
  END;

 Procedure _UStrToString(Dest: PShortString; Const Source: UnicodeString; MaxLen: Integer);
  ASM
   JMP RTL_UStrToString
  END;

 //==================
 // RTL Extensions
 //==================

 Procedure RTLExtend_StringConv(Var Ex: TRTLEx_StringConv);
  BEGIN
   _INT_RTL_DoEx(@RTL_LStrFromPWCharLen, @Ex._LStrFromPWCharLen);
   _INT_RTL_DoEx(@RTL_LStrFromWChar, @Ex._LStrFromWChar);
   _INT_RTL_DoEx(@RTL_LStrFromPWChar, @Ex._LStrFromPWChar);
   _INT_RTL_DoEx(@RTL_LStrFromString, @Ex._LStrFromString);
   _INT_RTL_DoEx(@RTL_LStrFromWArray, @Ex._LStrFromWArray);
   _INT_RTL_DoEx(@RTL_LStrFromWStr, @Ex._LStrFromWStr);
   _INT_RTL_DoEx(@RTL_LStrFromUStr, @Ex._LStrFromUStr);
   _INT_RTL_DoEx(@RTL_LStrToString, @Ex._LStrToString);
   _INT_RTL_DoEx(@RTL_WCharToString, @Ex._WCharToString);
   _INT_RTL_DoEx(@RTL_WStrFromPCharLen, @Ex._WStrFromPCharLen);
   _INT_RTL_DoEx(@RTL_WStrFromChar, @Ex._WStrFromChar);
   _INT_RTL_DoEx(@RTL_WStrFromPChar, @Ex._WStrFromPChar);
   _INT_RTL_DoEx(@RTL_WStrFromString, @Ex._WStrFromString);
   _INT_RTL_DoEx(@RTL_WStrFromArray, @Ex._WStrFromArray);
   _INT_RTL_DoEx(@RTL_WStrFromLStr, @Ex._WStrFromLStr);
   _INT_RTL_DoEx(@RTL_WStrFromUStr, @Ex._WStrFromUStr);
   _INT_RTL_DoEx(@RTL_WStrToString, @Ex._WStrToString);
   _INT_RTL_DoEx(@RTL_UStrFromPCharLen, @Ex._UStrFromPCharLen);
   _INT_RTL_DoEx(@RTL_UStrFromChar, @Ex._UStrFromChar);
   _INT_RTL_DoEx(@RTL_UStrFromPChar, @Ex._UStrFromPChar);
   _INT_RTL_DoEx(@RTL_UStrFromString, @Ex._UStrFromString);
   _INT_RTL_DoEx(@RTL_UStrFromArray, @Ex._UStrFromArray);
   _INT_RTL_DoEx(@RTL_UStrFromLStr, @Ex._UStrFromLStr);
   _INT_RTL_DoEx(@RTL_UStrFromWStr, @Ex._UStrFromWStr);
   _INT_RTL_DoEx(@RTL_UStrToString, @Ex._UStrToString);
   _INT_RTL_DoEx(@UnicodeToUTF8, @Ex.UnicodeToUTF8);
   _INT_RTL_DoEx(@UTF8ToUnicode, @Ex.UTF8ToUnicode);
   _INT_RTL_DoEx(@_UTF8EncodeW, @Ex._UTF8EncodeW);
   _INT_RTL_DoEx(@_UTF8EncodeU, @Ex._UTF8EncodeU);
   _INT_RTL_DoEx(@_UTF8EncodeL, @Ex._UTF8EncodeL);
   _INT_RTL_DoEx(@_UTF8EncodeWToShortString, @Ex._UTF8EncodeWToShortString);
   _INT_RTL_DoEx(@_UTF8EncodeUToShortString, @Ex._UTF8EncodeUToShortString);
   _INT_RTL_DoEx(@_UTF8EncodeLToShortString, @Ex._UTF8EncodeLToShortString);
   _INT_RTL_DoEx(@UTF8ToWideString, @Ex.UTF8ToWideString);
   _INT_RTL_DoEx(@_UTF8LStrToUnicodeString, @Ex._UTF8LStrToUnicodeString);
   _INT_RTL_DoEx(@_UTF8PStrToUnicodeString, @Ex._UTF8PStrToUnicodeString);
   _INT_RTL_DoEx(@_UTF8PCharToUnicodeString, @Ex._UTF8PCharToUnicodeString);
   _INT_RTL_DoEx(@_UTF8LStrToString, @Ex._UTF8LStrToString);
   _INT_RTL_DoEx(@_UTF8PStrToString, @Ex._UTF8PStrToString);
   _INT_RTL_DoEx(@_UTF8PCharToString, @Ex._UTF8PCharToString);
   _INT_RTL_DoEx(@_UTF8ArrayToString, @Ex._UTF8ArrayToString);
  END;

 Procedure _INT_StringConv_Init;
  BEGIN
   // RTL_LStrFromPWCharLen : Already Initialized
   // RTL_LStrFromWChar : Already Initialized
   // RTL_LStrFromPWChar : Already Initialized
   // RTL_LStrFromString : Already Initialized
   // RTL_LStrFromWArray : Already Initialized
   // RTL_LStrFromWStr : Already Initialized
   // RTL_LStrFromUStr : Already Initialized
   // RTL_LStrToString : Already Initialized
   // RTL_WCharToString : Already Initialized
   // RTL_WStrFromPCharLen : Already Initialized
   // RTL_WStrFromChar : Already Initialized
   // RTL_WStrFromPChar : Already Initialized
   // RTL_WStrFromString : Already Initialized
   // RTL_WStrFromArray : Already Initialized
   // RTL_WStrFromLStr : Already Initialized
   // RTL_WStrFromUStr : Already Initialized
   // RTL_WStrToString : Already Initialized
   // RTL_UStrFromPCharLen : Already Initialized
   // RTL_UStrFromChar : Already Initialized
   // RTL_UStrFromPChar : Already Initialized
   // RTL_UStrFromString : Already Initialized
   // RTL_UStrFromArray : Already Initialized
   // RTL_UStrFromLStr : Already Initialized
   // RTL_UStrFromWStr : Already Initialized
   // RTL_UStrToString : Already Initialized
   UnicodeToUTF8:= _RTL_UnicodeToUTF8;
   UTF8ToUnicode:= _RTL_UTF8ToUnicode;
   _UTF8EncodeW:= _RTL_UTF8EncodeW;
   _UTF8EncodeU:= _RTL_UTF8EncodeU;
   _UTF8EncodeL:= _RTL_UTF8EncodeL;
   _UTF8EncodeWToShortString:= _RTL_UTF8EncodeWToShortString;
   _UTF8EncodeUToShortString:= _RTL_UTF8EncodeUToShortString;
   _UTF8EncodeLToShortString:= _RTL_UTF8EncodeLToShortString;
   UTF8ToWideString:= _RTL_UTF8ToWideString;
   _UTF8LStrToUnicodeString:= _RTL_UTF8LStrToUnicodeString;
   _UTF8PStrToUnicodeString:= _RTL_UTF8PStrToUnicodeString;
   _UTF8PCharToUnicodeString:= _RTL_UTF8PCharToUnicodeString;
   _UTF8LStrToString:= _RTL_UTF8LStrToString;
   _UTF8PStrToString:= _RTL_UTF8PStrToString;
   _UTF8PCharToString:= _RTL_UTF8PCharToString;
   _UTF8ArrayToString:= _RTL_UTF8ArrayToString;
  END;

{$ENDIF Include_Modules_Implement}
(******************)
(* Initialization *)
(******************)
{$IFDEF Include_Modules_Initialize}
{$ENDIF Include_Modules_Initialize}
(****************)
(* Finalization *)
(****************)
{$IFDEF Include_Modules_Finalize}
{$ENDIF Include_Modules_Finalize}

